const proxy = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    proxy('/monet/studio/api', {
      target: 'http://localhost:8888',
      secure: false,
      changeOrigin: true,
      headers: {
        Host: '',
        Connection: 'keep-alive',
      },
      pathRewrite: {
        '^/monet/studio/api': '/monet/studio/api',
      },
    })
  );

  app.use(
    proxy('/api/visualdata/file', {
      target: 'http://11.51.204.41',
      secure: false,
      changeOrigin: true,
      headers: {
        Host: '',
        Connection: 'keep-alive',
      },
      pathRewrite: {
        '^/api/visualdata/file': '/api/visualdata/file',
      },
    })
  );
};
